// 云函数入口文件
const cloud = require('wx-server-sdk')

cloud.init()
const db = cloud.database();
const articles = db.collection('articles');
const _ = db.command;
// 云函数入口函数
exports.main = async (event, context) => {
  const wxContext = cloud.getWXContext()

  return articles.doc(event.id).update({
    data: {
      // 表示指示数据库将字段自增 10
      article_volume: _.inc(1)
    },
    success(res) {
      console.log(res.data)
    }, fail(err) {
      console.log(res.data)
      
    }
  })
}